﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
//
using PerceptiveMCAPI;
using PerceptiveMCAPI.Types;
//

namespace PerceptiveMCAPI_Test
{
   public partial class show_campaignStatsEmail : System.Web.UI.UserControl
   {
      public void Display( campaignHardBouncesOutput output )
      {
         FormatOutput( output.result );
      }
      public void Display( campaignSoftBouncesOutput output )
      {
         FormatOutput( output.result );
      }
      public void Display( campaignUnsubscribesOutput output )
      {
         FormatOutput( output.result );
      }
      public void Display( campaignNotOpenedAIMOutput output )
      {
         FormatOutput( output.result );
      }

      private void FormatOutput( List<string> emails )
      {
         this.Visible = true;
         lblCount.Text = emails.Count.ToString();

         gvEmails.DataSource = emails;
         gvEmails.DataBind();
      }

      protected void gvEmails_RowDataBound( object sender, GridViewRowEventArgs e )
      {
         if ( e.Row.RowType == DataControlRowType.Header )
         {
            e.Row.Cells[0].Text = "Email Address";
         }
      }
   }
}